Skip to content

[Nexthop][fboss2-dev] Add integration test for LoadBalancer.id - #1815

Closed
abhinav-nexthop wants to merge 2 commits into
meta:mainfrom
nexthop-ai:load-balancer-id
Closed

abhinav-nexthop wants to merge 2 commits into
meta:mainfrom
nexthop-ai:load-balancer-id

Conversation

@abhinav-nexthop

@abhinav-nexthop abhinav-nexthop commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Covers LoadBalancer.id in the existing ConfigLoadBalancingTest.EcmpHashSeed test, through the shared testSeed helper, rather than in a separate test.

LoadBalancer.id is the key config load-balancing ecmp|lag uses to find the entry it updates, and the key the agent stores the entry under in loadBalancerMaps. The test runs:

fboss2-dev config load-balancing ecmp hash-seed <seed>

It then checks that the running config still has exactly one load balancer with that id, carrying the new seed, and that the switch-state entry stored under that key has the new seed and its own id equals the key. The LAG load balancer must be unchanged in both.

The test seed is the current seed with the low bit flipped (or 1 if unset), so it never matches the existing value. The original seed is restored at the end, and by a scope guard if a check fails. The create path (an absent id gets a new entry) is covered by the unit test CmdConfigLoadBalancingTestFixture.applyCreatesNewLoadBalancer.

Test Plan

$ fboss2_integration_test --gtest_filter='ConfigLoadBalancingTest.EcmpHashSeed'
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from ConfigLoadBalancingTest
[ RUN      ] ConfigLoadBalancingTest.EcmpHashSeed
[       OK ] ConfigLoadBalancingTest.EcmpHashSeed (53 ms)
[----------] 1 test from ConfigLoadBalancingTest (53 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (53 ms total)
[  PASSED  ] 1 test.

@abhinav-nexthop
abhinav-nexthop requested a review from a team as a code owner October 19, 2026 08:39
@github-actions github-actions Bot added nexthop project:fboss2-dev FBOSS project: fboss2-dev labels Oct 19, 2026
@meta-cla meta-cla Bot added the CLA Signed label Oct 19, 2026
@abhinav-nexthop

Copy link
Copy Markdown
Contributor Author

/autorebase

@meta-codesync

meta-codesync Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D131379339.

Address review on the upstream PR: LoadBalancerIdSelectsEntry re-ran the
same command as EcmpHashSeed, hardcoded a seed that fails on a switch
already using it, and matched switch-state entries on the value's id
rather than the loadBalancerMaps key.

Drop the separate test and have testSeed check, for the load balancer it
changes, that the running config still has exactly one entry with that id,
that the switch-state entry stored under that key carries the new seed and
its own id equals the key, and that the other load balancer is untouched in
both. Derive the test seed from the current one so it always differs, and
restore it from a scope guard so a failed check leaves the switch as found.
@facebook-github-tools

Copy link
Copy Markdown

@abhinav-nexthop has updated the pull request. You must reimport the pull request before landing.

@abhinav-nexthop

Copy link
Copy Markdown
Contributor Author

/autorebase

@meta-codesync

meta-codesync Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu merged this pull request in 4e29ac8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants